package com.etc.dao;

import com.etc.entity.Watercup;
import com.etc.entity.WatercupExample;
import com.etc.entity.WatercupKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface WatercupMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    long countByExample(WatercupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    int deleteByExample(WatercupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    @Delete({
        "delete from watercup",
        "where w_id = #{wId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(WatercupKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    @Insert({
        "insert into watercup (w_id, w_type, ",
        "w_color, w_capacity, ",
        "w_price, w_grade, ",
        "w_name, w_image)",
        "values (#{wId,jdbcType=INTEGER}, #{wType,jdbcType=VARCHAR}, ",
        "#{wColor,jdbcType=VARCHAR}, #{wCapacity,jdbcType=VARCHAR}, ",
        "#{wPrice,jdbcType=VARCHAR}, #{wGrade,jdbcType=VARCHAR}, ",
        "#{wName,jdbcType=VARCHAR}, #{wImage,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="wId", before=true, resultType=Integer.class)
    int insert(Watercup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    int insertSelective(Watercup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    List<Watercup> selectByExample(WatercupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "w_id, w_type, w_color, w_capacity, w_price, w_grade, w_name, w_image",
        "from watercup",
        "where w_id = #{wId,jdbcType=INTEGER}"
    })
    @ResultMap("com.etc.dao.WatercupMapper.BaseResultMap")
    Watercup selectByPrimaryKey(WatercupKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") Watercup record, @Param("example") WatercupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") Watercup record, @Param("example") WatercupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(Watercup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table watercup
     *
     * @mbg.generated
     */
    @Update({
        "update watercup",
        "set w_type = #{wType,jdbcType=VARCHAR},",
          "w_color = #{wColor,jdbcType=VARCHAR},",
          "w_capacity = #{wCapacity,jdbcType=VARCHAR},",
          "w_price = #{wPrice,jdbcType=VARCHAR},",
          "w_grade = #{wGrade,jdbcType=VARCHAR},",
          "w_name = #{wName,jdbcType=VARCHAR},",
          "w_image = #{wImage,jdbcType=VARCHAR}",
        "where w_id = #{wId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Watercup record);
}